package com.wlz.consumer.consumer;

import com.wlz.api.DemoService;
import com.wlz.consumer.listener.DemoServiceListenerImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;

/**
 *  服务超时
 * @author wlz
 * @date 2022-07-12  10:15 下午
 */
@Slf4j
@EnableAutoConfiguration
public class CallbackDubboConsumerDemo {

    @Reference(version = "callback")
    private DemoService demoService;

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(CallbackDubboConsumerDemo.class, args);

        DemoService demoService = context.getBean(DemoService.class);


        String result = demoService.sayHello("wlz callback ...","d1", new DemoServiceListenerImpl());
        log.info("result:  {}", result);

        String result2 = demoService.sayHello("wlz callback ...","d2", new DemoServiceListenerImpl());
        log.info("result2:  {}", result2);

        String result3 = demoService.sayHello("wlz callback ...","d3", new DemoServiceListenerImpl());
        log.info("result3:  {}", result3);
    }
}
